package logic

import (
	"context"
	"everyone/B/rpc_B/model/mysql"

	"everyone/B/rpc_B/everyone"
	"everyone/B/rpc_B/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserUpdateLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewUserUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserUpdateLogic {
	return &UserUpdateLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *UserUpdateLogic) UserUpdate(in *everyone.UserUpdateRequest) (*everyone.UserUpdateResponse, error) {
	// todo: add your logic here and delete this line
	u := mysql.User{}
	err := u.Update(int64(u.ID), in.UserStatue)
	if err != nil {
		logx.Error("状态修改失败")
	}
	return &everyone.UserUpdateResponse{
		UserId: int64(u.ID),
	}, nil
}
